﻿

namespace PerformanceScalabilityTests
{
    using System;
    using System.Text;
    using System.Collections.Generic;
    using System.Runtime.CompilerServices;

    public class Helpers
    {
        public static string GetEnvirenmentInfo()
        {
            var stringbuilder = new StringBuilder();

            stringbuilder.AppendLine("Operation System:");
            stringbuilder.AppendLine("      " + Environment.OSVersion.VersionString);
            stringbuilder.AppendLine("Current CLR Version:");
            stringbuilder.AppendLine("      " + Environment.Version);
            stringbuilder.AppendLine("Processors and Cores Count:");
            stringbuilder.AppendLine("      " + Environment.ProcessorCount);

            return stringbuilder.ToString();
        } 
        
        /// <summary>
        /// WriteLog
        /// </summary>
        /// <param name="resulttimelist">List of Elapsed Times</param>
        [MethodImpl(MethodImplOptions.NoOptimization)]
        public  void WriteLog(IList<double> resulttimelist)
        {
            if (resulttimelist.Count == 1)
            {
                return;
            }

            for (var i = 1; i < resulttimelist.Count; i++)
            {
                Console.Write("Absolutely Acceleration: ");
                Console.WriteLine(resulttimelist[0] / resulttimelist[i]);

                Console.Write("Relative Acceleration: ");
                Console.WriteLine(resulttimelist[i - 1] / resulttimelist[i]);
            }
        }
    }
}